home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
ext
/
events
/
zeitgeist_client.pyc
(
.txt
)
< prev
Wrap
Python Compiled Bytecode
|
2014-12-31
|
3KB
|
69 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import os
import sys
if os.name == 'nt' or sys.platform == 'darwin':
from quodlibet.plugins import PluginNotSupportedError
raise PluginNotSupportedError
import time
try:
import __builtin__
old_builtin = __builtin__.__dict__.copy()
from zeitgeist.client import ZeitgeistClient
from zeitgeist.datamodel import Event, Subject
from zeitgeist.datamodel import Interpretation, Manifestation
__builtin__.__dict__.update(old_builtin)
except ImportError:
e = None
from quodlibet import plugins
raise plugins.MissingModulePluginException('zeitgeist') if hasattr(plugins, 'MissingModulePluginException') else e
from quodlibet.plugins.events import EventPlugin
class Zeitgeist(EventPlugin):
PLUGIN_ID = 'zeitgeist'
PLUGIN_NAME = _('Event Logging')
PLUGIN_DESC = _('Send song events to the Zeitgeist event logging service')
PLUGIN_ICON = 'gtk-network'
PLUGIN_VERSION = '0.1'
def enabled(self):
self.client = ZeitgeistClient()
self._Zeitgeist__stopped_by_user = False
def disabled(self):
del self.client
del self._Zeitgeist__stopped_by_user
def plugin_on_song_started(self, song):
if self._Zeitgeist__stopped_by_user:
manifestation = Manifestation.USER_ACTIVITY
else:
manifestation = Manifestation.SCHEDULED_ACTIVITY
self._Zeitgeist__send_event(song, Interpretation.ACCESS_EVENT, manifestation)
def plugin_on_song_ended(self, song, stopped):
self._Zeitgeist__stopped_by_user = stopped
if stopped:
manifestation = Manifestation.USER_ACTIVITY
else:
manifestation = Manifestation.SCHEDULED_ACTIVITY
self._Zeitgeist__send_event(song, Interpretation.LEAVE_EVENT, manifestation)
def __send_event(self, song, interpretation, manifestation):
if not song:
return None
None('event: interpretation=%s, manifestation=%s' % (interpretation.__name__, manifestation.__name__))
subject = Subject.new_for_values(uri = song('~uri'), interpretation = Interpretation.AUDIO, manifestation = Manifestation.FILE_DATA_OBJECT)
event = Event.new_for_values(timestamp = int(time.time() * 1000), interpretation = interpretation, manifestation = manifestation, actor = 'application://quodlibet.desktop', subjects = [
subject])
self.client.insert_event(event)